home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / misc / wexmast / wpdmenu.pro < prev    next >
Text File  |  1997-07-08  |  2KB  |  66 lines

  1. ; $Id: wpdmenu.pro,v 1.4 1997/01/15 04:29:15 ali Exp $
  2. ;
  3. ; Copyright (c) 1993-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. ; This is the code for a simple pull-down menu. Pulldown menus
  7. ; can appear in menubars or in standalone buttons. This example
  8. ; shows both forms using two buttons labeled "Colors" and "Quit".
  9. ; If "Colors" is selected, a pull-down menu appears.  Selecting a
  10. ; color causes its name to be printed in the IDL window.  If "Quit"
  11. ; is selected, the widget is destroyed.
  12.  
  13.  
  14. PRO wpdmenu_event, event
  15. ; This procedure is the event handler for a simple pull-down menu. 
  16.  
  17. ; If Quit is pressed, destroy all widgets:
  18.  
  19. IF (event.value EQ 'Quit') THEN WIDGET_CONTROL, event.top, /DESTROY
  20.  
  21. ; For Menu items, any VALUE returned will be the text of the menu item.
  22. ; Therefore, we can just print out the words in the IDL window as they
  23. ; are selected:
  24.  
  25. PRINT, event.value, ' selected.'
  26.  
  27. END
  28.  
  29.  
  30.  
  31. PRO wpdmenu, GROUP = GROUP
  32.  
  33. ; This COMMON block is not really necessary if we only have a menu:
  34.  
  35. COMMON wpdmenublock, hi
  36.  
  37. ; Make the top-level base widget:
  38.  
  39. base = WIDGET_BASE(TITLE = 'Pull-Down Menu Example', /COLUMN, XSIZE = 300, $
  40.                    MBAR = mbar)
  41.  
  42. ; The CW_PdMenu procedure will automatically create the menu items for us.
  43. ; We only have to give it the menu item labels. We do it twice, once in
  44. ; the menubar and once for standalone buttons.
  45.  
  46. menu_desc = ['1\File', $
  47.              '2\Quit', $
  48.              '1\Colors', $
  49.              '1\Red', $
  50.              '0\Candy Apple', $
  51.              '0\Medium', $
  52.              '2\Dark', $
  53.              '0\Orange', $
  54.              '2\Yellow']
  55.  
  56. menu = CW_PdMenu(mbar, /RETURN_NAME, menu_desc, UVALUE='THEMENU', /MBAR)
  57. menu = CW_PdMenu(base, /RETURN_NAME, menu_desc, UVALUE='THEMENU')
  58.  
  59. ; Realize the widgets:
  60. WIDGET_CONTROL, base, /REALIZE
  61.  
  62. ; Hand off to the XMANAGER:
  63. XMANAGER, 'wpdmenu', base, GROUP_LEADER = GROUP, /NO_BLOCK
  64.  
  65. END
  66.